import { API_LIST } from '../../../Api/Api'
import { commonTableList } from '../Common/common'
import { Button } from 'antd'

const { hostname } = window.location

const independenceList = {
    'jtgjadmin.ljkjkf.com': 'organizationUuid',
    'jtgjadmin.hljsjtgj.com': 'organizationUuid',
}

export const ListSjhtContract = async ({ url, OptionsEvent, ClientData, Permission, actionRef }) => {
    let data = {
        pageSize: 10,
        params: { pageIndex: 1 },
        get: API_LIST()[`get${url}`],
        added: `pos${url}`,
        modify: `put${url}`,
        delete: `del${url}`,
        hideInSearch: true,
        independenceSet: {
            title: '组织机构',
            url: 'getOrgTree',
            data: { IsByUserUuid: 1 },
            type: 'TableNavTree001',
            all: true,
        },
        independence: independenceList[hostname],
        hideInSearch: true,
        options: [<Button type="primary">新增</Button>],
        columns: [
            commonTableList.uuid,
            {
                dataIndex: 'bh',
                title: '编号',
                valueType: 'input',
                width: 80,
            },
            {
                dataIndex: 'htmc',
                title: '合同名称',
                valueType: 'input',
                width: 120,
            },
            {
                dataIndex: 'htlx',
                title: '合同类型',
                valueType: 'input',
                width: 80,
            },
            {
                dataIndex: 'je',
                title: '金额',
                valueType: 'input',
                width: 120,
            },
            {
                dataIndex: 'name',
                title: '姓名',
                valueType: 'input',
                width: 80,
            },
            {
                dataIndex: 'createtime',
                title: '时间',
                valueType: 'input',
                width: 120,
            },
            {
                title: '操作',
                valueType: 'systemOperation',
                fixed: 'right',
                width: 80,
                hideInSearch: true,
                hideInAdded: true,
                hideInModify: true,
                render: (_, record) => {
                    return [
                        <Button key="1" type="link">
                            修改
                        </Button>,
                        <Button key="2" type="link" danger>
                            删除
                        </Button>,
                    ]
                },
            },
        ],
    }

    return data
}
